<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>TestPages</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
    <h:outputStylesheet library="css" name="tableCar-style.css"/>
    <f:view locale="#{userBean.locale}"/>
</h:head>
<h:body>
    <ui:decorate template="/sample.xhtml">
        <ui:define name="body">

            <h:form>
                <table class="simple-little-table" cellspacing='0'>
                    <tr>
                        <th>****</th>
                        <th>Параметры :</th>
                        <th>---</th>
                    </tr>
                    <!-- Table Header -->
                    <tr>
                        <td>Тип транспорта :</td>
                        <td><h:selectOneMenu value="#{carAdd.transportTypesUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.transportTypeSet}">
                            <f:selectItems value="#{carAdd.transportTypes}" var="typeCar"
                                           itemLabel="#{typeCar.name_ru}" itemValue="#{typeCar.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Бренд :</td>
                        <td><h:selectOneMenu value="#{carAdd.brandsUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.brandSet}">
                            <f:selectItems value="#{carAdd.brands}" var="brand"
                                           itemLabel="#{brand.name_ru}" itemValue="#{brand.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>

                    <tr>
                        <td>Модель :</td>
                        <td><h:selectOneMenu value="#{carAdd.modelUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.modelSet}">
                            <f:selectItems value="#{carAdd.models}" var="model"
                                           itemLabel="#{model.name_ru}" itemValue="#{model.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Тип кузова :</td>
                        <td><h:selectOneMenu value="#{carAdd.carTypesUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.carTypesSet}">
                            <f:selectItems value="#{carAdd.carTypes}" var="carType"
                                           itemLabel="#{carType.name_ru}" itemValue="#{carType.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Год производства :</td>
                        <td>
                            ---
                        </td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Состояние :</td>
                        <td><h:selectOneMenu value="#{carAdd.conditionsUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.conditionsSet}">
                            <f:selectItems value="#{carAdd.conditions}" var="condition"
                                           itemLabel="#{condition.name_ru}" itemValue="#{condition.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Объем двигателя :</td>
                        <td>

                            <h:inputText value="#{carAdd.capasity}" id="capasity" label="Неверный объем двигателя">
                                <f:validateDoubleRange minimum="1" maximum="6"/>
                            </h:inputText>
                            <h:messages for="capasity" style="color: red" showDetail="false" />

                        </td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Трансмиссия :</td>
                        <td><h:selectOneMenu value="#{carAdd.transmissionUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.transportTypeSet}">
                            <f:selectItems value="#{carAdd.transmissions}" var="transm"
                                           itemLabel="#{transm.name_ru}" itemValue="#{transm.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Привод :</td>
                        <td><h:selectOneMenu value="#{carAdd.privodsUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.privodSet}">
                            <f:selectItems value="#{carAdd.privods}" var="privod"
                                           itemLabel="#{privod.name_ru}" itemValue="#{privod.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Цвет :</td>
                        <td><h:selectOneMenu value="#{carAdd.colorUser}" onchange="submit()"
                                             valueChangeListener="#{carAdd.colorSet}">
                            <f:selectItems value="#{carAdd.colors}" var="color"
                                           itemLabel="#{color.name_ru}" itemValue="#{color.id}"/>
                        </h:selectOneMenu></td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <td>Описание :</td>
                        <td>
                            <h:inputTextarea value="#{carAdd.description}"/>

                        </td>
                        <td>---</td>
                    </tr>
                    <tr>
                        <th>Цена :

                            <h:inputText value="#{carAdd.price}" id="price"
                                         label="lloo">
                                <f:validateDoubleRange maximum="100000" minimum="100"/>
                            </h:inputText>

                            <h:selectOneMenu value="#{carAdd.currencyUser}"
                                             onchange="submit()"
                                             valueChangeListener="#{carAdd.currencySer}">
                                <f:selectItems value="#{carAdd.currency}" var="currency"
                                               itemLabel="#{currency.shortname_en}" itemValue="#{currency.id}"/>
                            </h:selectOneMenu>
                            <h:messages for="price" style="color: red"/>

                        </th>
                    </tr>
                </table>
                <h:commandButton value="Добавить объявление" action="#{carAdd.addCar}"/>
            </h:form>


        </ui:define>
    </ui:decorate>


</h:body>


</html>



